// let baseURL = "http://110.42.175.49:21127"   //网络接口

// let baseURL = "https://cqkjg.bowu66.cn" //本地接口
let baseURL = "https://mpyy.cqkjg.cn:48443" //正式接口
// let URL = "http://test.static.bowu66.com/"

function request(url,data={},method="get"){
let token = wx.getStorageSync("token")
  return new Promise((resolve,reject)=>{
    wx.request({
      url: baseURL+url,
      data:data,
      method:method,
      header:{
          "content-type":"application/json",
          token:token,
          appId:'wx9c25f8e317416cd5'
      },
      success:(result)=>{
        if(result.data.code === 1000){
        resolve(result.data)
        // console.log(result);
          // console.log(result.data.code);
        } else {
            resolve(result)
        }
      },
      fail:(err)=>{
        reject(err)
      }
    })
  })
}

module.exports={
  request
}

